package org.spolo.android.shape;

import org.spolo.android.nodetree.Vcanvas;

import android.graphics.Canvas;

public class Rectangle extends Vcanvas {

	/**
	 * @param x
	 *            起始坐标点X值
	 * @param y
	 *            起始坐标点Y值
	 * @param width
	 *            矩形的宽
	 * 
	 * @param height
	 *            矩形的高
	 */
	public Rectangle(float startx, float starty, float width, float height) {
		super();
		setDirtyRect(startx, starty, width, height);

	}

	@Override
	public void drawSelfImplement(Canvas canvas) {
		float[] center = getCenter();
		float sx = (center[0] - (this.width / 2));
		float sy = (center[1] - (this.height / 2));
		float ex = (center[0] + (this.width / 2));
		float ey = (center[1] + (this.height / 2));
		canvas.drawRect(sx, sy, ex, ey, this.getPaint());
	}
}
